<template>
  <!-- 没有开启命名空间的模块 -->
  <p>{{$store.state.modulesA.a}}</p>
  <p>{{$store.getters.newData}}</p>

  <!-- 开启命名空间的模块 -->
  <p>{{$store.state.modulesB.b}}</p>
  <p>{{$store.getters['modulesB/newData']}}</p>

  <button @click="fn">改数据</button>
  <button @click="fn1">改数据</button>
  <button @click="actions">改数据</button>
</template>
<script>
import { useStore } from 'vuex'

export default {
  name: 'App',
  setup () {
    const store = useStore()
    const fn = () => {
      store.commit('modulesA/updata')
    }

    const fn1 = () => {
      store.commit('modulesB/updata')
    }
    const actions = () => {
      store.dispatch('modulesB/update')
    }
    return { fn, fn1, actions }
  }

}
</script>
<style lang="less">

</style>
